package com.atguigu.tree;

public class SegmentTreeTest {

    public static void main(String[] args) {
        Integer[]nums={-2,0,3,-5,2,-1};
        SegmentTree<Integer>segTree1=new SegmentTree<>(nums, Integer::sum);
        System.out.println(segTree1.query(0, 2));//1
        System.out.println(segTree1.query(2,5));//-1


        segTree1.set(2,1);
        System.out.println(segTree1.query(0, 2));//-1
        System.out.println(segTree1.query(2,5));//-3

    }
}
